[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
tmpfile() Create a Temporary File
#include <stdio.h>
FILE *tmpfile(void);
tmpfile() creates and opens a temporary file is "w+b" (binary
read/write) mode. The temporary file is automatically deleted when
it's closed (using fclose()) or when the program terminates.
Returns: A pointer to the temporary file, if successful. If
the file can't be created, NULL is returned.
-------------------------------- Example ---------------------------------
#include <stdio.h>
main()
{
FILE *stream;
char *buffr = "data to be entered";
if ((stream = tmpfile()) != NULL) {
fprintf(stream,"%s",buffr);
printf("temp file opened & data entered");
fclose(stream);
}
else
perror("unable to open temp file\n");
}
See Also:
creat()
fopen()
mktemp()
open()
tmpnam()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson